/**
 * 
 */
package cn.easybay.util;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;



/**
 * @author 86503
 *
 */
public class MybatisUtil {
  private static SqlSessionFactory sf;
  
  static{
	  try {
		InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
		sf= new SqlSessionFactoryBuilder().build(is);
	} catch (Exception e) {
		
		e.printStackTrace();
	}
  }
  public static SqlSession getSession(){
	return sf.openSession();
	  
  }
}
